package com.hyc.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@EnableWebMvc
public class UIWebMvcConfigurer implements WebMvcConfigurer {
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/error/404").setViewName("page/404");
        registry.addViewController("/img").setViewName("page/img/images");
        registry.addViewController("/index").setViewName("index");
        registry.addViewController("/index/newsList").setViewName("page/news/newsList");

        registry.addViewController("/user").setViewName("page/user/userList");
        registry.addViewController("/user/userAdd").setViewName("page/user/userAdd");
        registry.addViewController("/userGrade").setViewName("page/user/userGrade");

        registry.addViewController("/sysParam/basic").setViewName("page/systemSetting/basicParameter");
        registry.addViewController("/sysLog").setViewName("page/systemSetting/logs");
        registry.addViewController("/icon").setViewName("page/systemSetting/icons");
        registry.addViewController("/link").setViewName("page/systemSetting/linkList");
        registry.addViewController("/linksAdd").setViewName("page/systemSetting/linksAdd");

        registry.addViewController("/doc/addressDoc").setViewName("page/doc/addressDoc");
        registry.addViewController("/doc/bodyTabDoc").setViewName("page/doc/bodyTabDoc");
        registry.addViewController("/doc/navDoc").setViewName("page/doc/navDoc");
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
    }
}
